<template>
    <div class="right">
        <div class="right-top">
            <!-- <div class="lesson"> -->
            <div class="lesson-name">
                <div class="lesson-title">人间烟火教学</div>
                <div class="return" @click="$router.push('/training')">返回</div>
            </div>
            <div class="lesson-detail">
                <img src="../../../../../../public/1.png" alt="" />
                <div class="user">青花瓷9999</div>
                <span>创建于2022-1-1</span>
            </div>
            <!-- </div> -->
        </div>
        <div class="right-bottom">
            <div class="training-item" v-for="item in detailList" :key="item.id">
                <div class="content">
                    <div class="cover"><img class="img" :src="item.cover" /></div>
                    <div class="infomation">
                        <div class="title">{{ item.contentName }}</div>
                        <div class="times">未开始</div>
                    </div>
                    <div class="status">
                        <div>开始练习</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import mockApi from '@/api/mockApi';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
const route = useRoute();
const detailList = ref();
const getDetailInfo = async () => {
    try {
        let result = await mockApi.getDetailInfo(route.query.id as string);
        detailList.value = result.data[0].content;
        console.log(detailList);
    } catch (error) {
        console.log(error);
    }
};
onMounted(() => {
    getDetailInfo();
});
</script>

<style lang="less" scoped>
.right {
    width: 1020px;
    display: block;
    padding: 0 10px;
}
.right-top {
    background-color: #fff;
    height: 82px;
    padding: 30px;
}
.lesson-name {
    height: 28px;
    justify-content: space-between;
    display: flex;
    width: 100%;
}
.lesson-title {
    font-size: 24px;
    width: 144px;
    display: block;
}
.return {
    cursor: pointer;
    font-size: 14px;
    width: 80px;
    text-align: right;
    display: block;
}
.lesson-detail {
    height: 28px;
    margin-top: 24px;
    display: flex;
    align-items: center;
    height: 28px;
    img {
        height: 28px;
        width: 28px;
        margin-right: 10px;
        border-radius: 100%;
    }
    span {
        font-size: 14px;
        color: #666;
    }
}
.user {
    margin-right: 20px;
    font-size: 16px;
}
.creat {
    position: absolute;
    top: 36px;
    right: 84px;
    background: #f93684;
    height: 30px;
    width: 78px;
    border-radius: 21px;
    text-align: center;
    line-height: 30px;
}

.right-bottom {
    height: 700px;
    background-color: #fff;
    border-radius: 4px;
    margin-top: 10px;
    position: relative;
    /* display: flex; */
    /* justify-content: center;
    align-items: center; */
    padding-top: 20px;
}
.training-item {
    height: 142px;
    width: 100%;
    margin-left: 30px;
}
.content {
    height: 101px;
    width: 950px;
    padding: 20px 0;
    display: flex;
    position: relative;
    border-bottom: 1px solid #e3e3e3;
}
.cover {
    width: 169px;
    height: 101px;
    border-radius: 4px;
    background-size: cover;
    background-position: 50%;
    margin-right: 20px;
    display: block;
}
.img {
    width: 169px;
    height: 101px;
}
.infomation {
    display: block;
    width: 335px;
}
.times {
    margin-top: 25px;
    font-size: 14px;
    color: #7d8090;
}
.status {
    text-align: center;
    float: right;
    position: absolute;
    top: 43px;
    right: 0px;
    width: 89px;
    background: #f93684;
    height: 40px;
    line-height: 31px;
    border-radius: 5px;
    color: #fff;
    display: none;
}
.content:hover .status {
    display: block;
}
.status > div {
    margin-top: 5px;
}

.none {
    margin-bottom: 20px;
}
</style>
